<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Route
 *
 * @author Propietario
 */
class Route extends AppModel 
{
    
   public function routesList($limit) 
           {
               /*     return $this->query("SELECT Route.id AS Route_Id,
                    DATE_ADD( load_availability_date, INTERVAL effective_days DAY ),
                    Route.email, 
                    Route.load_availability_date, 
                    DATE_FORMAT(Route.load_availability_date,GET_FORMAT(DATE, 'EUR')) AS Availability_Date,
                    DATE_FORMAT( DATE_ADD( load_availability_date, INTERVAL effective_days DAY) ,GET_FORMAT(DATE, 'EUR')) AS New_Availability_Date,
                    Route.comments AS Comment, 
                    Route.vehicle_id AS Vehicle_Id, 
                    Route.vehicleType_id AS Vehicle_Type_Id, 
                    Route.municipalityOrigin_id AS City_Origin, 
                    Route.stateOrigin_id AS State_Origin, 
                    Route.municipalityDestiny_id AS City_Id, 
                    Route.stateDestiny_id AS State_Id, 
                    Route.effective_days, 
                    vehicles.id, 
                    vehicles.name AS Vehicle_Name, 
                    vehicle_types.id, 
                    vehicle_types.name AS Vehicle_Type_Name,
                    states.name AS State_Destiny_Name,
                    states.abbreviation AS State_D_Abbrev,
                    states.id, 
                    cities.name AS City_Destiny_Name, 
                    cities.id,
                    statesOrigin.name AS State_Origin_Name,
                    statesOrigin.abbreviation AS State_O_Abbrev,
                    statesOrigin.id, 
                    citiesOrigin.name AS City_Origin_Name, 
                    citiesOrigin.id,
                    zone.name AS Zone_Name, 
                    zone.number AS Zone_Number, 
                    zone.id_city, 
                    zone.id_state
                    FROM routes AS Route
                    LEFT JOIN vehicles ON ( Route.vehicle_id = vehicles.id ) 
                    LEFT JOIN vehicle_types ON ( Route.vehicleType_id = vehicle_types.id ) 
                    LEFT JOIN states ON ( stateDestiny_id = states.id ) 
                    LEFT JOIN cities ON ( municipalityDestiny_id = cities.id)
                    LEFT JOIN states AS statesOrigin ON ( stateOrigin_id = statesOrigin.id ) 
                    LEFT JOIN cities AS citiesOrigin ON ( municipalityOrigin_id = citiesOrigin.id) 
                    LEFT JOIN zone ON (zone.id_city = municipalityDestiny_id) AND (stateDestiny_id=zone.id_state)
                    ORDER BY Route_Id 
                    DESC LIMIT ".$limit."");*/
            }
   
}
